Copyright(C) 1994 Terumasa KODAKA , Takeshi KONO ■Calendar/Interval Timer BIOS INT 1Ch - Function 00h Classification TIMER BIOS Name Reading date and time Target Normal, High Resolution, PC-98LT/HA Input AH=00h ES:BX=First address of data buffer Output AX=Undefined <Buffer format> ------------------+----------------------------------- Address | Contents ------------------+----------------------------------- ES:BX+00h | Year (BCD:00-99h) ES:BX+01h bit 7-4 | Month (1h=January, …, Ch=December) bit 3-0 | Day of week (0h=Sunday, …, 6h=Saturday) ES:BX+02h | Day (BCD:01-31h) ES:BX+03h | Hour (BCD:00-23h) ES:BX+04h | Minutes (BCD: 00-59h) ES:BX+05h | Seconds (BCD: 00-59h) ------------------+----------------------------------- * BCD: bits 7-4 are the tens digit, bits 3-0 are the ones digit Explanation o Gets the date and time from the calendar clock LSI and writes them to the specified buffer. u When extracting time information from the calendar clock LSI, it is necessary to read each bit serially, so this function takes about 0.5m-1.0m seconds (depending on conditions) to execute. o On the original PC-9801, E, F, M, U, VM2, VF, UV2, PC-98XA, and PC-98LT, the year information is stored in memory switch 8, so the year is not updated automatically. Leap years are not taken into account either. On other models, the year is updated and the leap year February 29th is set automatically. u In some lots of PC-9801P/BA2/BS2/BX2 and PC-9821Ne/Ap2/As2/Bp/Bs/Be/Ts, when the date changes with the power off, the year is not updated and the leap year February 29th is not automatically set. NEC has released a patch to avoid this symptom. When this patch is applied to IO.SYS, INT 1Ch is hooked, but this can take up to three times longer than before the patch. u The technical data book states that AX becomes undefined, but in reality it does not change. Related INT 1Ch - Function 01h I/O 0020h A000:3FFEh[PC-9801 original/E/F/M/U/VM2/VF/UV2] E000:3FFEh[PC-98XA] D000:3808h[PC-98LT] INT 1Ch - Function 01h Classification TIMER BIOS Name Date and time setting Target Normal, High Resolution, PC-98LT/HA Input AH=01h ES:BX=First address of data buffer <Buffer format> ------------------+----------------------------------- Address | Contents ------------------+----------------------------------- ES:BX+00h | Year (BCD:00-99h) ES:BX+01h bit 7-4 | Month (1h=January, …, Ch=December) bit 3-0 | Day of week (0h=Sunday, …, 6h=Saturday) ES:BX+02h | Day (BCD:01-31h) ES:BX+03h | Hour (BCD:00-23h) ES:BX+04h | Minute (BCD:00-59h) ES:BX+05h | Seconds (BCD: 00-59h) ------------------+----------------------------------- * In BCD, bits 7-4 are the tens digit, and bits 3-0 are the ones digit. Output AX=undefined Explanation o Sets the date and time to the calendar clock LSI. u When setting time information to the calendar clock LSI, each bit must be written serially, so this function takes about 0.5m-1.0m seconds (depending on the model and conditions). u The technical data book states that AX becomes undefined, but in reality it does not change. Related INT 1Ch - Function 00h I/O 0020h A000:3FFEh[PC-9801 original, E, F, M, U, VM2, VF, UV2] E000:3FFEh[PC-98XA] D000:3808h[PC-98LT] INT 1Ch - Function 02h Classification TIMER BIOS Name Interval timer setting (single event) Target Normal, Hi-Res, PC-98LT/HA Input AH=02h CX=Interval timer value (unit: 10ms) * If 0 is specified, it will operate as 10000h ES:BX=User routine entry at timeout Output AX=Undefined Explanation o When the time specified by CX has elapsed since executing this function, the user routine specified by ES:BX will be called once. Since this function is for single events, once you have set it with this function, you cannot execute it again until the timeout occurs. If you execute this function again before the timeout occurs, the previous setting will be invalidated and only the new setting will be valid. o In Hi-Res mode, the multi-event compatible functions of INT 1Ch - Function 04h, 05h can be executed even before the setting made with this function times out. In this case, the setting made with this function will not be invalidated. u In normal mode (excluding PC-98DO+) and PC-98LT・HA, executing this function performs the following processes. - Sets the entry address of the user routine specified in ES:BX to the INT 07h vector. - Sets the interval timer value specified in CX to 0000:058Ah. - Sets channel 0 of the timer (8253A) to generate a pulse with a period of 10 ms. - Sets the master of the interrupt controller (8259A) to enable the interrupt INT 08h (external interrupt). After that, INT 08h (external interrupt) is generated every 10 ms, and the timer interrupt handler in the BIOS decrements the interval timer value (0000:058Ah). When the interval timer value reaches 0 and times out, INT 07h is executed to call the user routine. u In high-resolution mode and PC-98DO+, executing this function performs the following processes. - Set the entry address of the user routine specified in ES:BX to 0000:044Ch. - Set the interval timer value specified in CX to 0000:058Ah. - If the timer interrupt is not in use, set channel 0 of the timer (8253A) to generate a pulse with a period of 10 ms. Also set the master of the interrupt controller (8259A) to enable the interrupt INT 08h (external interrupt). After that, INT 08h (external interrupt) will be generated every 10 ms, and the timer interrupt handler in the BIOS will decrement the interval timer value (0000:058Ah). When the interval timer value reaches 0 and times out, a PUSHF is performed, and then the address set in 0000:044Ch is FAR-called to call the user routine. o When creating a user routine, do the following. - All registers other than flags must be guaranteed within the user routine. - The BIOS issues an EOI (End Of Interrupt) to the interrupt controller before moving to a user routine. An EOI must not be issued within a user routine. - When the user routine has finished processing, it returns with IRET. u When a user routine is called, the state of the CPU's IF (Interrupt Flag) differs depending on the model, as follows: In normal mode (except PC-98DO+) and PC-98LT/HA, it is 0 (interrupts disabled). In high-resolution mode and PC-98DO+, it is 1 (interrupts enabled). u In PC-98DO+, the address of the user routine is not the INT 07h vector, but the same address as high-resolution mode (0000:044Ch). u In some lots of the first generation PC-9801, the part that should be accessing the timer down counter 0000:058Ah accesses 0050:058Ah, and in such cases it does not work correctly. u The technical data book states that AX becomes undefined, but in reality it does not change. Related INT 07h (Timer BIOS) INT 08h (External interrupt) 0000:044Ch [Hi-Res, PC-98DO+] 0000:0459h bit 5 [Hi-Res] 0000:058Ah I/O 0000h I/O 0071h INT 1Ch - Function 03h (Hi-Res) Classification TIMER BIOS Name Timer Cancel Target Hi-Res Input AH=03h ES:BX=Address of parameter block to cancel Output AH=End condition (End condition is not actually returned. See "Function" column) 00h: Normal end FFh: Memory specified by ES:BX is not registered as a parameter block Explanation o Cancels the setting of the interval timer started by INT 1Ch - Function 04h, 05h. u The technical data book states that the end condition is returned to AH, but in reality it does not change from the state before the call. Related INT 1Ch - Function 04h INT 1Ch - Function 05h INT 1Ch - Function 03h Classification TIMER BIOS Name Timer BIOS internal use Target Normal, PC-98LT/HA Input AH=03h Output None Explanation o Called from INT 08h interrupt handler. Loads the interval timer count value (10 ms period) into channel 0 of the 8253A and releases the timer interrupt of the interrupt controller. Related INT 1Ch - Function 02h INT 1Ch - Function 04h Classification TIMER BIOS Name Interval timer setting (multi-event compatible, one-shot mode) Target Hi-Res Input AH=04h ES:BX=Address of parameter block (12 bytes) <Parameter block format> -----------------+-------------------------------------- Address | Contents -----------------+-------------------------------------- ES:BX+00h(DWORD) | BIOS work area (pointer to next parameter block) ES:BX+04h(WORD) | BIOS work area (for repeated mode) ES:BX+06h(WORD) | Interval timer value (unit: 10ms) ES:BX+08h(DWORD) | User routine entry at timeout -----------------+-------------------------------------- * The BIOS work area does not need to be set by the user Output AX=Undefined Explanation o When the time specified by ES:BX+06h has elapsed since this function was executed, the user routine specified by ES:BX+08h will be called once. This function supports multiple events, so you can register another event before the initial setting (event) times out. u When this function is executed, the following processing is performed. - If the timer interrupt is not in use, ES:BX is set to 0000:0444h to set channel 0 of the timer (8253A) to generate a pulse with a 10 ms period. It also sets the master of the interrupt controller (8259A) to enable the interrupt INT 08h (external interrupt). - If the timer interrupt is in use, it follows the link from 0000:0444h and adds the parameter block specified this time to the link. The interrupt handler for INT 08h (external interrupt), which occurs every 10 ms, follows the link from 0000:0444h and decrements the interval timer values of all registered events. When an event occurs in which the interval timer value reaches 0 and a timeout occurs, the user routine entry at the time of the timeout is copied from the parameter block to the INT 07h vector, and INT 07h is executed to call the user routine. The parameter block of the event that timed out is deleted from the link. o When creating a user routine, do the following. - All registers other than flags must be guaranteed in the user routine. - When execution is transferred to the user routine, the CPU's IF (Interrupt Flag) is 0 (interrupts disabled). - The BIOS issues an EOI (End Of Interrupt) to the interrupt controller before moving to the user routine. EOI must not be issued within a user routine. - When user routine processing is complete, return with IRET. u The technical data book states that AH should be set to 00h when issuing IRET from a user routine, but this is not necessary. u The technical data book states that AX becomes undefined, but in reality it does not change. Related INT 1Ch - Function 02h INT 1Ch - Function 03h 0000:0444h 0000:0459h bit 5 INT 1Ch - Function 05h Category TIMER BIOS Name Interval timer setting (multi-event compatible, repeated mode) Target Hi-Res Input AH=05h ES:BX=parameter block address <parameter block format> ------------------+-------------------------------------- Address | Contents ------------------+-------------------------------------- ES:BX+00h(DWORD) | BIOS work area (pointer to next parameter block) ES:BX+04h(WORD) | BIOS work area (initial timeout value) ES:BX+06h(WORD) | Timeout value (unit: 10ms) ES:BX+08h(DWORD) | User routine entry at timeout ------------------+-------------------------------------- * The BIOS work area does not need to be set by the user. Output AX=undefined Explanation o When this function is executed, the user routine specified by ES:BX+08h is called at the time interval specified by ES:BX+06h. This function supports multiple events, so you can register additional events before the first setting (event) times out. u When this function is executed, the following processing is performed. - If the timer interrupt is not in use, ES:BX is set to 0000:0444h, and a 10 ms periodic pulse is generated on channel 0 of the timer (8253A). Also, the interrupt controller (8259A) master is set to enable interrupts for INT 08h (external interrupt). - If the timer interrupt is in use, the link from 0000:0444h is followed, and the parameter block specified this time is added to the link. The interrupt handler for INT 08h (external interrupt), which occurs every 10 ms, follows the link from 0000:0444h and decrements the interval timer value of all registered events. If an event occurs in which the interval timer value reaches 0 and a timeout occurs, the user routine entry at the time of the timeout is copied from the parameter block to the INT 07h vector, and INT 07h is executed to call the user routine. When returning from a user routine with a value other than AH=00h, this event is reset. When returning from a user routine with AH=00h, the parameter block of this event is deleted from the link. o When creating a user routine, do the following. - All registers except flags must be guaranteed within the user routine. - When execution has been transferred to the user routine, the CPU's IF (Interrupt Flag) is 0 (interrupts disabled). - The BIOS issues an EOI (End Of Interrupt) to the interrupt controller before transitioning to the user routine. EOI must not be issued within a user routine. - When the user routine processing is finished, return with IRET. - When returning with IRET, set the repeat condition in AH. 00h: Stop repeating FFh: Continue repeating u The technical data book states that AX becomes undefined, but in reality it does not change. Related INT 1Ch - Function 02h INT 1Ch - Function 03h 0000:0444h 0000:0459h bit 5 INT 1Ch - Function 06h Classification TIMER BIOS Name Beep function Target Hi-Res Input AH=06h CX=Beep time (unit: 10msec) * No sound when 0 DX=8253A frequency division value Output None Explanation o Beep sounds at the specified time and frequency. The beep is stopped by a timer interrupt, so this function ends without waiting for the beep to stop. u Executing this function does not affect the default buzzer frequency set in INT 18h - Function 23h. o INT 18h - Function 24h sets the frequency in DX, whereas this function sets the frequency division value of the 8253A. Related INT 18h - Function 24h 0000:0448h 0000:044Ah INT 1Ch - Function 07h Category TIMER BIOS Name Alarm function setting Target PC-98HA Input AH=07h ES:BX=Data buffer (6 bytes) <Data buffer format> ------------------+----------------------------------- Address | Contents ------------------+----------------------------------- ES:BX+00h | Month (BCD:01-12h) ES:BX+01h | Day (BCD:01-31h) ES:BX+02h | Day of the week (always set to FFh) ES:BX+03h | Hour (BCD:00-23h) ES:BX+04h | Minute (BCD:00-59h) ES:BX+05h | Seconds (BCD: 00-59h) ------------------+----------------------------------- * If 0Fh is set, that digit will always be considered to match the set time. 0Fh can be set in 4-bit increments. Output CF=End condition (End condition is not actually returned. See "Function" column) 1=Abnormal end 0=Normal end Explanation o When the specified time arrives, if the power is OFF, it will automatically turn ON and execute the alarm sounding function (INT 1Fh - Function 8Eh,8Fh). o If the application or driver is to sound the alarm (buzzer), it is necessary to trap INT 1Fh - Function 8Eh,8Fh and handle the buzzer sounding independently. u The technical data book states that the end condition is returned to CF, but in reality it is always 0. Related INT 1Ch - Function 08h INT 1Ch - Function 09h INT 1Fh - Function 8Eh INT 1Fh - Function 8Fh I/O 0022h INT 1Ch - Function 08h Classification TIMER BIOS Name Clear alarm setting Target PC-98HA Input AH=08h Output CF=End condition (End condition is not actually returned. See "Function" column) 1=Abnormal end 0=Normal end Explanation o Clears the alarm setting set with INT 1Ch - Function 07h. u The technical data book says that the end condition is returned to CF, but in reality it is always 0. Related INT 1Ch - Function 07h INT 1Ch - Function 09h Classification TIMER BIOS Name Reading alarm setting status Target PC-98HA Input AH=09h ES:BX=Start address of data buffer Output CF=End status 1=Setting 0=Not setting Explanation o Reads the alarm setting contents set in INT 1Ch - Function 07h. If the setting is made, writes the date and time data to the buffer specified by ES:BX. The buffer format is the same as function 07h. Related INT 1Ch - Function 07h